//
//  CommonViewController.m
//  Taoke
//
//  Created by JIAJINJUN on 2016/11/3.
//  Copyright © 2016年 JIAJINJUN. All rights reserved.
//

#import "CommonViewController.h"
#import "CommonUtils.h"

@interface CommonViewController ()<UIScrollViewDelegate,UIGestureRecognizerDelegate>

@end

@implementation CommonViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    if (self.navigationItem.leftBarButtonItem == nil) {
        [self.navigationItem setHidesBackButton:YES];
        [self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"arrow_left"] style:UIBarButtonItemStylePlain target:self action:@selector(popViewControllerAnimated:)]];
    }
    [self.navigationItem.leftBarButtonItem setTintColor:[UIColor colorWithRGB:color_6c]];
    [self.navigationItem.rightBarButtonItem setTintColor:[UIColor colorWithRGB:color_6c]];
    self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
    self.navigationItem.rightBarButtonItem.tintColor = [UIColor colorWithRGB:color_MinGreen];
}

-(void)addTapResigerKeyBoardGesture{
    UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(ResigerKeyBoard)];
    tapGesture.delegate = self;
    [self.view addGestureRecognizer:tapGesture];
}

-(void)ResigerKeyBoard{}


-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:NO];
    [self.navigationController setNavigationBarHidden:NO];
    if (self.navigationController.viewControllers.count > 1) {
        self.tabBarController.tabBar.hidden = YES;
    }else {
        self.tabBarController.tabBar.hidden = NO;
    }
}

-(void)viewWillDisappear:(BOOL)animated
{
    [super viewDidDisappear:NO];
    [self.navigationController setNavigationBarHidden:NO];
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    [self ResigerKeyBoard];
}


-(void)popViewControllerAnimated:(BOOL)animated{
    [self.navigationController popViewControllerAnimated:animated?animated:YES];
}






@end
